const path = require('path')

function resolve(dir) {
	return path.join(__dirname, dir)
}
module.exports = {
	runtimeCompiler: true,
	productionSourceMap: false,
	configureWebpack: {
		devtool: 'source-map'
	},
	css: {
		loaderOptions: {
			sass: {
				sassOptions: {
					outputStyle: "expanded"
				}
			},
			scss: {
				data: `@import "@/styles/theme.scss";`,
			}
		}
	},
	chainWebpack(config) {
		config.module.rule('svg').exclude.add(resolve('src/assets/icons')).end()
		config.module.rule('icons')
			.test(/\.svg$/)
			.include.add(resolve('src/assets/icons')).end()
			.use('svg-sprite-loader')
			.loader('svg-sprite-loader')
			.options({
				symbolId: 'icon-[name]'
			}).end()
	},
	devServer: {
		proxy: { //设置代理，必须填
			'/ai_face/': { //设置拦截器  拦截器格式   斜杠+拦截器名字，名字可以自己定
				target: 'http://27.19.36.138:85/ai_face/', //代理的目标地址
				changeOrigin: true, //是否设置同源
				pathRewrite: { //路径重写
					'^/ai_face/': '' //选择忽略拦截器里面的单词
				}
			}
		}
	}
}